/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package model.entities;

import java.io.Serializable;
import java.math.BigDecimal;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.metamodel.Type;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;

/**
 *
 * @author maged.abdelmoeti
 */
@Entity
@Table(name = "REPORT_PARAMETERS")
@NamedQueries({
    @NamedQuery(name = "ReportParameters.findAll", query = "SELECT r FROM ReportParameters r"),
    @NamedQuery(name = "ReportParameters.findById", query = "SELECT r FROM ReportParameters r WHERE r.id = :id"),
    @NamedQuery(name = "ReportParameters.findByParamName", query = "SELECT r FROM ReportParameters r WHERE r.paramName = :paramName"),
    @NamedQuery(name = "ReportParameters.findByParamType", query = "SELECT r FROM ReportParameters r WHERE r.paramType = :paramType"),
    @NamedQuery(name = "ReportParameters.findByParamValue", query = "SELECT r FROM ReportParameters r WHERE r.paramValue = :paramValue")})
public class ReportParameters implements Serializable {
    private static final long serialVersionUID = 1L;
    // @Max(value=?)  @Min(value=?)//if you know range of your decimal fields consider using these annotations to enforce field validation
    @Id
    @Basic(optional = false)
    @NotNull
    @Column(name = "ID")
    private BigDecimal id;
    @Size(max = 20)
    @Column(name = "PARAM_NAME")
    private String paramName;
    @Size(max = 20)
    @Column(name = "PARAM_TYPE")
    private String paramType;
    @Size(max = 20)
    @Column(name = "PARAM_VALUE")
    private String paramValue;
    
    @JoinColumn(name = "REPORT_ID", referencedColumnName = "ID")
    @ManyToOne(fetch = FetchType.EAGER)
    private Report reportId;

    @Column(name = "required")
    private char  required ;

    
    
    public boolean getRequired() {
        return required == '1';
    }

    public void setRequired(boolean required) {
         this.required = required ? '1' : '0';
    }




    public ReportParameters() {
    }

    public ReportParameters(BigDecimal id) {
        this.id = id;
    }

    public BigDecimal getId() {
        return id;
    }

    public void setId(BigDecimal id) {
        this.id = id;
    }

    public String getParamName() {
        return paramName;
    }

    public void setParamName(String paramName) {
        this.paramName = paramName;
    }

    public String getParamType() {
        return paramType;
    }

    public void setParamType(String paramType) {
        this.paramType = paramType;
    }

    public String getParamValue() {
        return paramValue;
    }

    public void setParamValue(String paramValue) {
        this.paramValue = paramValue;
    }

    public Report getReportId() {
        return reportId;
    }

    public void setReportId(Report reportId) {
        this.reportId = reportId;
    }



    
    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof ReportParameters)) {
            return false;
        }
        ReportParameters other = (ReportParameters) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "model.entities.ReportParameters[ id=" + id + " ]";
    }
    
}
